<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; utf-8">
<title>查询员工列表</title>
</head>
<script type="text/javascript">
function deleteStuffs(){
	//提交form
	document.stuffForm.action="${pageContext.request.contextPath }/stuff/deleteStuffs.action";
	document.stuffForm.submit();
}
function queryStuffs(){
	document.stuffForm.action="${pageContext.request.contextPath }/stuff/queryStuff.action";
	document.stuffForm.submit();
}
</script>
<body>
当前用户：${username }
<c:if test="${username!=null }">
<a href="${pageContext.request.contextPath }/user/logout.action" >退出</a>
</c:if>
	<form name="stuffForm" action="${pageContext.request.contextPath }/stuff/queryStuff.action" method="post">
		查询条件：
		<table width="100%" border=1>
			<tr>
				<td>工号：<input name="stuffnumber" />
				<td>姓名：<input name="name" />
				所在部门：
				<select name="idStuffdepartment">
					<option value="">所有部门</option>
					<c:forEach items="${departments }" var="department" >
							<option value="${department.idStuffdepartment }"
							<c:if test="${department.idStuffdepartment==selectedDepartmentId }">selected="selected"</c:if>
							>${department.name }</option>
					</c:forEach>
				</select>
				</td>
				<td><input type="button" value="查询" onclick="queryStuffs()"/></td>
				<td><input type="button" value="批量删除" onclick="deleteStuffs()"/></td>
			</tr>
		</table>
		<table width="100%" border=1>
			<tr>
				<td>id</td>
				<td>工号</td>
				<td>姓名</td>
				<td>部门</td>
			</tr>
			<c:forEach items="${stuffs }" var="stuff">
				<tr>
					<td><input type="checkbox" name="stuff_id" value="${stuff.idStuff }"/></td>
					<td>${stuff.stuffnumber }</td>
					<td><a href="${pageContext.request.contextPath }/stuff/queryStuffByStuffId.action?idStuff=${stuff.idStuff} ">${stuff.name }</a></td>
					<td>${stuff.departmentName }</td>
				</tr>
			</c:forEach>
		</table>
	</form>
	<!-- 
	<td>${stuff.price }</td>
					<td><fmt:formatDate value="${item.createtime }"
							pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td>${item.detail }</td>
					<td><a href="${pageContext.request.contextPath }/items/editItems.action?id=${item.id }">修改</a></td>
				
	 -->
</body>
</html>